Skip to content

Conversation

@mdayican
Copy link
Contributor

@mdayican mdayican commented Oct 8, 2025

EM-6870 add mimetype update task

@mdayican mdayican force-pushed the EM-6870-add-mimetask branch from b1781c7 to 457e0ca Compare October 9, 2025 06:02
@mdayican mdayican marked this pull request as ready for review October 10, 2025 12:10
@yogesh-hullatti
Copy link
Contributor

Hi @mdayican ,
My comments as below,

  1. Remove unused method from src/main/java/uk/gov/hmcts/dm/repository/DocumentContentVersionRepository.java - markMimeTypeUpdated()
  2. We have 12 attributes in DocumentContentVersion. We are updating 2 attributes - mimeType & mimeTypeUpdated. Instead of making the DB call to load the entire object. We can use something like below which I believe is efficient and lots of lines of code can be removed related to loading and try/catch.
//Efficient: repository-level update to avoid loading the entity
// In DocumentContentVersionRepository:
@Modifying
@Query("update DocumentContentVersion d set d.mimeType = :mimeType, d.mimeTypeUpdated = true where d.id = :id")
int updateMimeType(@Param("id") UUID id, @Param("mimeType") String mimeType);

@mdayican
Copy link
Contributor Author

Hi @mdayican , My comments as below,

  1. Remove unused method from src/main/java/uk/gov/hmcts/dm/repository/DocumentContentVersionRepository.java - markMimeTypeUpdated()
  2. We have 12 attributes in DocumentContentVersion. We are updating 2 attributes - mimeType & mimeTypeUpdated. Instead of making the DB call to load the entire object. We can use something like below which I believe is efficient and lots of lines of code can be removed related to loading and try/catch.
//Efficient: repository-level update to avoid loading the entity
// In DocumentContentVersionRepository:
@Modifying
@Query("update DocumentContentVersion d set d.mimeType = :mimeType, d.mimeTypeUpdated = true where d.id = :id")
int updateMimeType(@Param("id") UUID id, @Param("mimeType") String mimeType);

fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants